package org.autumn.log;

import cn.hutool.core.io.file.FileReader;
import org.apache.commons.lang3.builder.ToStringExclude;
import org.junit.Test;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.logging.*;

public class TestJul {

    public static void main(String[] args) throws IOException {
        LogManager.getLogManager()
                .readConfiguration(
                        new FileReader("logging.properties").getInputStream());
//        System.getProperties().put("java.util.logging.config.file","/Users/mikael/IdeaProjects/data-structure/src/main/resources/logging.properties");

        Logger logger = Logger.getLogger("org.autumn.log.TestJul");

//        ConsoleHandler consoleHandler = new ConsoleHandler();
//        consoleHandler.setFormatter(new SimpleFormatter());
//        consoleHandler.setLevel(Level.ALL);
//        logger.addHandler(consoleHandler);
//        logger.setLevel(Level.ALL);

        // 文件处理器 输出到文件
//        FileHandler fileHandler = new FileHandler("/Users/mikael/logs/jul.log");
//        fileHandler.setFormatter(new SimpleFormatter());
//        logger.addHandler(fileHandler);

        logger.severe("hello severe");
        logger.warning("hello warning");
        logger.info("hello info");
        logger.config("hello config");
        logger.fine("hello fine");
        logger.finer("hello finer");
        logger.finest("hello finest");
//        logger.log(Level.INFO,"info: {0},{1}",new Object[]{"mikale","22"});
    }

//    @Test
//    public void test01(){
//        Logger parent = logger.getParent();
//        System.out.println(parent);
//    }


}
